<?php
namespace app\index\controller;
use app\index\model\User as UserModel;
use app\common\AdminController;
class User extends AdminController
{
	// protected  $model;
	// protected function initialize()
 //    {
 //       $this->model = new UserModel;
 //    }
    // protected $batchValidate = true;
	public function index(){
       
    }
  
    public function create(){
        echo '222';
    }
    public function login(UserModel $UserModel)
    {
        
        if(request()->isAjax() && request()->isPost()){ 
             return $UserModel->login();
        }
        return view('login');
    }

    public function register(UserModel $UserModel){
       
    	if(request()->isAjax() && request()->isPost()){
            return $UserModel->register();
        }
        return view('register');
    }
    public function logout(){
        cookie('uid',null);
       return true;
    }
    public function userinfo($id){
        $userinfo = UserModel::where('id',$id)->find();
        return view('userinfo',['userinfo'=>$userinfo]);
    }
}

